Quản lý nhân sự công ty bằng c# _ full source code
60.457 lượt xem;
- TransDialog1.cs
- QuanLyNhanSu /
- project /
1 using System;
2 using System.ComponentModel;
3 using System.Data;
4 using System.Drawing;
5 using System.Text;
6 using System.Windows.Forms;
7
8 namespace QuanLyNhanSu
9 {
10 /// <summary>
11 /// Base class that gives any form that derives from it the effect of slowly
12 /// appearing and then disapperaing. Much like outlook email notification pop-ups
13 /// </summary>
14 public class TransDialog1 : System.Windows.Forms.Form
15 {
16 #region Constructor
17 public TransDialog1()
18 {
19 InitializeComponents();
20 }
21 public TransDialog1(bool disposeAtEnd)
22 {
23 m_bDisposeAtEnd = disposeAtEnd;
24 InitializeComponents();
25 }
26 void InitializeComponents()
27 {
28 this.components1 = new System.ComponentModel.Container();
29 this.m_clock = new Timer(this.components1);
30 this.m_clock.Interval = 10;
31 this.SuspendLayout();
32 //m_clock
33 this.m_clock.Tick += new EventHandler(Animate);
34 //TransDialog
35 this.Load += new EventHandler(TransDialog_Load);
36 this.Closing += new CancelEventHandler(TransDialog_Closing);
37 this.ResumeLayout(false);
38 this.PerformLayout();
39 }
40 #endregion
41
42 #region Event handlers
43 private void TransDialog_Load(object sender, EventArgs e)
44 {
45 this.Opacity = 0.0;
46 m_bShowing = true;
47
48 m_clock.Start();
49 }
50
51 private void TransDialog_Closing(object sender, CancelEventArgs e)
52 {
53 if (!m_bForceClose)
54 {
55 m_origDialogResult = this.DialogResult;
56 e.Cancel = true;
57 m_bShowing = false;
58 m_clock.Start();
59 }
60 else
61 {
62 this.DialogResult = m_origDialogResult;
63 }
64 }
65
66 #endregion
67
68 #region Private methods
69 private void Animate(object sender, EventArgs e)
70 {
71 if (m_bShowing)
72 {
73 if (this.Opacity < 1)
74 {
75 this.Opacity += 0.01;
76 }
77 else
78 {
79 m_clock.Stop();
80 }
81 }
82 else
83 {
84 if (this.Opacity > 0)
85 {
86 this.Opacity -= 0.01;
87 }
88 else
89 {
90 m_clock.Stop();
91 m_bForceClose = true;
92 this.Close();
93 if (m_bDisposeAtEnd)
94 this.Dispose();
95 }
96 }
97 }
98
99 #endregion
100
101 #region overrides
102 protected override void Dispose(bool disposing)
103 {
104 if (disposing && (components1 != null))
105 {
106 components1.Dispose();
107 }
108 base.Dispose(disposing);
109 }
110 #endregion
111
112 #region private variables
113 private System.ComponentModel.IContainer components1 = null;
114 private Timer m_clock;
115 private bool m_bShowing = true;
116 private bool m_bForceClose = false;
117 private DialogResult m_origDialogResult;
118 private bool m_bDisposeAtEnd = false;
119 #endregion // private variables
120
121 }
122 }
2 using System.ComponentModel;
3 using System.Data;
4 using System.Drawing;
5 using System.Text;
6 using System.Windows.Forms;
7
8 namespace QuanLyNhanSu
9 {
10 /// <summary>
11 /// Base class that gives any form that derives from it the effect of slowly
12 /// appearing and then disapperaing. Much like outlook email notification pop-ups
13 /// </summary>
14 public class TransDialog1 : System.Windows.Forms.Form
15 {
16 #region Constructor
17 public TransDialog1()
18 {
19 InitializeComponents();
20 }
21 public TransDialog1(bool disposeAtEnd)
22 {
23 m_bDisposeAtEnd = disposeAtEnd;
24 InitializeComponents();
25 }
26 void InitializeComponents()
27 {
28 this.components1 = new System.ComponentModel.Container();
29 this.m_clock = new Timer(this.components1);
30 this.m_clock.Interval = 10;
31 this.SuspendLayout();
32 //m_clock
33 this.m_clock.Tick += new EventHandler(Animate);
34 //TransDialog
35 this.Load += new EventHandler(TransDialog_Load);
36 this.Closing += new CancelEventHandler(TransDialog_Closing);
37 this.ResumeLayout(false);
38 this.PerformLayout();
39 }
40 #endregion
41
42 #region Event handlers
43 private void TransDialog_Load(object sender, EventArgs e)
44 {
45 this.Opacity = 0.0;
46 m_bShowing = true;
47
48 m_clock.Start();
49 }
50
51 private void TransDialog_Closing(object sender, CancelEventArgs e)
52 {
53 if (!m_bForceClose)
54 {
55 m_origDialogResult = this.DialogResult;
56 e.Cancel = true;
57 m_bShowing = false;
58 m_clock.Start();
59 }
60 else
61 {
62 this.DialogResult = m_origDialogResult;
63 }
64 }
65
66 #endregion
67
68 #region Private methods
69 private void Animate(object sender, EventArgs e)
70 {
71 if (m_bShowing)
72 {
73 if (this.Opacity < 1)
74 {
75 this.Opacity += 0.01;
76 }
77 else
78 {
79 m_clock.Stop();
80 }
81 }
82 else
83 {
84 if (this.Opacity > 0)
85 {
86 this.Opacity -= 0.01;
87 }
88 else
89 {
90 m_clock.Stop();
91 m_bForceClose = true;
92 this.Close();
93 if (m_bDisposeAtEnd)
94 this.Dispose();
95 }
96 }
97 }
98
99 #endregion
100
101 #region overrides
102 protected override void Dispose(bool disposing)
103 {
104 if (disposing && (components1 != null))
105 {
106 components1.Dispose();
107 }
108 base.Dispose(disposing);
109 }
110 #endregion
111
112 #region private variables
113 private System.ComponentModel.IContainer components1 = null;
114 private Timer m_clock;
115 private bool m_bShowing = true;
116 private bool m_bForceClose = false;
117 private DialogResult m_origDialogResult;
118 private bool m_bDisposeAtEnd = false;
119 #endregion // private variables
120
121 }
122 }